@use "sass:color";
@charset "UTF-8";
// Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
// This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
// conditions defined in the file COPYING, which is part of this source code package.

/*-------------------------------------------------------------------------.
|                      _                _                                  |
|                     | |    ___   __ _(_)_ __                             |
|                     | |   / _ \ / _` | | '_ \                            |
|                     | |__| (_) | (_| | | | | |                           |
|                     |_____\___/ \__, |_|_| |_|                           |
|                                 |___/                                    |
+--------------------------------------------------------------------------+
| Styling of the login page (when not HTTP Basic Auth is used)             |
'-------------------------------------------------------------------------*/

body.login {
  text-align: center;
  vertical-align: middle;

  div#login {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 770px;
    height: 605px;
    margin: auto;
    color: $font-color;
    background: transparent;
  }

  #login_window {
    position: relative;
    top: 187px;
    left: 10px;
    width: 370px;
    height: auto;
    margin: -30px auto 10px;
    background: $navigation-bg-color;
    border-radius: 8px;
    padding: 2.5 * $spacing 4 * $spacing;
    box-sizing: border-box;

    .login_window_logo_link {
      display: block;
      width: 120px;
      height: auto;
    }

    div.trial_expiration_info {
      margin: 24px 0;
      padding: 12px 16px;
      text-align: left;
      background-color: $bg-color;
      border-radius: $theme-border-radius;

      span.remaining_time {
        font-weight: $font-weight-bold;
        color: color.adjust($new-success, $lightness: -5%);
      }

      div.time_bar {
        div {
          display: inline-block;
          height: 4px;

          &.passed {
            background-color: $navbar-color;
          }

          &.remaining {
            background-color: color.adjust($new-success, $lightness: -5%);
          }
        }
      }

      &.warning {
        color: $font-color;

        span.remaining_time {
          color: $trial-expiration-warn-color;
        }

        div.time_bar div.remaining {
          background-color: $trial-expiration-warn-color;
        }
      }
    }

    table {
      margin: 1.3 * $spacing 0;
      border-spacing: 0;

      td {
        padding-bottom: 1.3 * $spacing;

        &.login_label {
          padding-top: 2px;
        }

        &.login_input {
          padding-left: 2.7 * $spacing;
        }
      }
    }
  }

  #version {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 150px;
    letter-spacing: $letter-spacing-table;
    text-align: right;
  }

  #label_user,
  #label_pass {
    letter-spacing: $letter-spacing-table;
  }

  #label_user,
  #input_user,
  #label_pass,
  #input_backup,
  #input_pass {
    float: left;
  }

  #input_user,
  #input_backup,
  #input_pass {
    width: 183px;
    height: $input-field-height;
    box-shadow: none;
  }

  #_login,
  #_saml2_login_button,
  #_use_totp_code,
  #_use_backup_code,
  input.mode_button {
    width: 100%;
    height: 29px;
    padding: 7px 16px;
    margin: 0;
    font-weight: $font-weight-bold;
    border: 1px solid $default-submit-button-border-color;
    background-color: color.adjust($new-success, $lightness: -5%);
  }

  #_login:not(.hot),
  #_saml2_login_button:not(.hot) {
    background-color: color.adjust($input-button-hover-bg-color, $lightness: -5%);
    &:hover {
      background-color: $input-button-hover-bg-color;
    }
    &:active {
      background-color: unset;
    }
  }

  div#saml_button {
    margin-top: 20px;
  }

  h2.login_separator {
    margin: 26px 0;
    text-align: center;
    border-bottom: 1px solid $font-color-light-grey;
    line-height: 0.1em;

    span {
      background-color: $navbar-color;
      padding: 0 $spacing;
    }
  }

  #login_error,
  #login_error_saml2 {
    width: 100%;
    height: auto;
    margin: $spacing auto;

    div.error {
      padding: 7px;
    }
  }

  #login_error_saml2 div.error {
    padding-top: 7px;
    padding-bottom: 7px;
    font-weight: $font-weight-bold;
    margin-bottom: 0;

    p {
      margin: 0;
      font-weight: $font-weight-default;
    }
  }

  #foot {
    position: relative;
    top: 187px;
    left: 10px;
    width: 350px;
    margin: 0 auto 10px;
    color: $font-color-dimmed;
    text-align: center;
  }

  div#login div#foot a,
  div#login div#foot body.main .popup_menu span,
  body.main .popup_menu div#login div#foot span {
    color: $font-color-dimmed;
  }

  &.two_factor {
    h1 {
      margin-left: 0;
      text-align: left;
      padding-top: $spacing-double;
    }

    p {
      text-align: left;
    }

    .button_text {
      padding-top: $spacing-double;
    }

    #code_input {
      text-align: left;
      input {
        height: $font-size-page-title;
      }
    }

    a {
      text-decoration: underline;
    }

    input.mode_button {
      background-color: $ux-theme-6;
    }
  }
}
